﻿<UserControl 
    x:Class="Microsoft.Samples.WindowsPhoneCloud.Phone.PivotContent.ListBlobsPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    d:DataContext="{d:DesignData ../DesignData/ListBlobsPageViewModelSampleData.xaml}"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <StackPanel Grid.Row="0" Orientation="Vertical">
                <StackPanel Orientation="Vertical">
                    <TextBlock Text="Prefix" FontSize="{StaticResource PhoneFontSizeNormal}" FontFamily="{StaticResource PhoneFontFamilyNormal}" VerticalAlignment="Top" LineHeight="31" LineStackingStrategy="BlockLineHeight" Foreground="{StaticResource PhoneSubtleBrush}" TextWrapping="Wrap" Margin="12,0,12,-5"  />
                    <TextBox Text="{Binding Prefix, Mode=TwoWay}" />
                </StackPanel>

                <StackPanel Grid.Row="1" Orientation="Horizontal">
                    <Button Content="list blobs" Click="OnListBlobs" Width="228" />
                    <CheckBox Margin="5,0,0,0" IsChecked="{Binding UseFlatBlobListing, Mode=TwoWay}" Content="Flat blob listing" Foreground="{StaticResource PhoneForegroundBrush}" />
                </StackPanel>
            </StackPanel>

            <ListBox Grid.Row="1" Margin="0,20,0,0" ItemsSource="{Binding CloudBlobs}" Visibility="{Binding HasResults, Converter={StaticResource VisibilityConverter}}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel>
                            <Image Margin="10,5,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" Width="130" Height="130" Stretch="Uniform" Source="{Binding Uri}" />
                            <HyperlinkButton Margin="0,0,0,35" Padding="0" HorizontalAlignment="Left" VerticalAlignment="Center" Content="{Binding Name}" NavigateUri="{Binding Uri}" TargetName="_blank" />
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
            
            <TextBlock Grid.Row="1" Margin="12,20" Visibility="{Binding HasResults, Converter={StaticResource VisibilityConverter}, ConverterParameter=true}" TextWrapping="Wrap" FontSize="{StaticResource PhoneFontSizeLarge}" Text="No blobs found." />

            <StackPanel Grid.Row="2" Margin="12,0,12,12" Orientation="Vertical" VerticalAlignment="Bottom">
                <TextBlock HorizontalAlignment="Left" Text="{Binding Message}" TextWrapping="Wrap" />
                <ProgressBar Height="20" IsIndeterminate="True" Visibility="{Binding IsListing, Converter={StaticResource VisibilityConverter}}" />
            </StackPanel>
        </Grid>
    </Grid>

</UserControl>
